//加载数字

import {DataStore} from "../base/DataStore.js";
import {Sprite} from "../base/Sprite.js";
const screenWidth    = window.innerWidth
const screenHeight   = window.innerHeight
export class LoadingCount extends Sprite{

    constructor() {
        super()
        this.ctx = DataStore.getInstance().ctx;
        this.scoreNumber = 0;
        //因为canvas刷新的很快，所以需要一个变量控制加分，只加一次
        this.isScore = true;
        
    }

    drawLoading() {
        this.ctx.font = '25px Arial';
        this.ctx.fillStyle = '#ffcbeb';
        this.ctx.fillText(
            this.scoreNumber,
            DataStore.getInstance().canvas.width / 2,
            200,
            1000
        );
    }

    darwLoadingBar(){
        const image = Sprite.getImage('LoadingBar');
        super.draw(image,
            0, 0,
            image.width, image.height,
            (screenWidth-image.width/2)/2,250,
            image.width/2, image.height/2);
        this.loadingX=(screenWidth-image.width/2)/2;//loading坐标
    }
    loadingBar(){
        const image = Sprite.getImage('LoadingColor');
        super.draw(image,
            0, 0,
            image.width, image.height,
            (screenWidth-image.width/2)/2,250,
            image.width/2, image.height/2);
    }
}